<?php
include_once 'fun.php';
include_once 'islogin.php';
$_SESSION['isadmin']=isset($_SESSION['isadmin'])?$_SESSION['isadmin']:'';
  if ($_SESSION['isadmin']!=2&&$_SESSION['isadmin']!=-1) {
      header('Refresh:1;url=shop.php');
      die("请以柜台管理员身份登录");
  }
    //var_dump($_POST);
    $productid = $_POST['productid'];
    $counterid = isset($_POST['counterid'])?$_POST['counterid']:'';
    
  
    if(empty($counterid))
    {
    header('Refresh:0;url=counter.php');
    die("柜台名不能为空");
    }
   
    else
    {
        $con=connect();
       
            $sql = "update counter set productid ='{$productid}' where counterid = '{$counterid}'";
            query($sql,$con);
            echo '添加成功';
        
    header('Refresh:0;url=counter.php');
    
    }
    
    
?>